﻿-- =============================================
-- Author:		<Author,,Name>
-- Create date: <Create Date,,>
-- Description:	<Description,,>
-- =============================================
CREATE PROCEDURE [dbo].[UpdateModelsAboveAverageDW]
	-- Add the parameters for the stored procedure here
AS
BEGIN
	-- SET NOCOUNT ON added to prevent extra result sets from
	-- interfering with SELECT statements.
	SET NOCOUNT ON;

    -- Insert statements for procedure here
	IF  EXISTS (SELECT 1 FROM sys.objects WHERE object_id = OBJECT_ID(N'[dbo].[ModelsAboveAverageDW]') AND type in (N'U')) 
	begin

		truncate table ModelsAboveAverageDW;

		insert into ModelsAboveAverageDW
		select *
		from ModelsAboveAverage;

	end
	else
	begin

		select *
		into ModelsAboveAverageDW
		from ModelsAboveAverage;

	end
END
